home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
COMM
/
DTR
/
DTRCTRL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-07-04
|
989b
|
40 lines
Unit DTRCtrl;
Interface
Var
MCRState : Byte;
COM : Array [1..4] Of Word;
Procedure DTRControl (COMPort: Byte; DTR: Boolean);
Function DTRState (COMPort: Byte): Boolean;
Implementation
Procedure DTRControl (COMPort: Byte; DTR: Boolean);
Begin
MCRState := Port [COM [COMPort] + 4]; {Get Modem Control Register in MCRState}
If (Not DTR) And (MCRState And $1 = 1) Then Dec (MCRState); {Drop DTR}
If (DTR) And (MCRState And $1 = 0) Then Inc (MCRState); {Raise DTR}
Port [COM [COMPort] + 4] := MCRState; {Set Modem Control Register from MCRState};
End;
Function DTRState (COMPort: Byte): Boolean;
Begin
MCRState := Port [COM [COMPort] + 4]; {Get Modem Control Register in MCRState}
If MCRState And $1 = 1 Then DTRState := True else DTRState := False;
End;
Begin
{COM Port adresses initialization}
COM [1] := 1016; COM [2] := 760; COM [3] := 1000; COM [4] := 744;
End.